package net.zjitc.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.zjitc.mapper.GoodsAlbumMapper;
import net.zjitc.pojo.GoodsAlbum;
import net.zjitc.service.GoodsAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:xuying
 * @date:2024/12/29 15:50:39
 */

@Service
public class GoodsAlbumServiceImpl implements GoodsAlbumService {
    @Autowired
    private GoodsAlbumMapper goodsAlbumMapper;

    @Override
    public List<GoodsAlbum> getGoodsAlbumListById(Integer goodsId) {
        QueryWrapper<GoodsAlbum> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("goods_id",goodsId);
        return goodsAlbumMapper.selectList(queryWrapper);
    }

    @Override
    public void updateGoodsAlbum(List<GoodsAlbum> goodsAlbum) {
        goodsAlbum.forEach(item -> goodsAlbumMapper.insertOrUpdate(item));

    }
}
